<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="./skin01/home_new_yh01.css">
    <link rel="stylesheet" href="./css/home_new_index_reform6.css">
    <link rel="stylesheet" href="./css/home_new_st.css">
</head>

<body>
    <div class="tuijian">
        <!--直播专区-->
        <div class="home_new-list zbzq">
            <div class="tztui-list-title jr-title pad15">
                <div class="btm-line">
                    <span class="title">直播专区</span>
                    <span class="more">
						<i class="right-arrow"></i>
					</span>
                </div>
            </div>
            <div class="live-broadcast-group">
                <div class="skeleton skeleton-animated" style="height: 2.22rem;width: 48%;"> </div>
                <div style="height: 2.22rem;width: 48%;">
                    <div class="skeleton skeleton-animated" style="height: 1.055rem;width: 100%;"> </div>
                    <div class="skeleton skeleton-animated" style="height: 1.055rem;width: 100%;margin-top: .05rem;"> </div>
                </div>
                <!-- <div class="live-broadcast-wrapper live-broadcast-wrapper-left">
                    <div class="live-broadcast-item">
                        <div class="live-broadcast-info">
                            <span><i class="live-broadcast-icon"></i><em>直播中</em></span>
                            <span>500人观看</span>
                        </div>
                        <img src="" alt="">
                        <div class="live-broadcast-desc">
                            <div class="title">多空信号这样用就对了</div>
                            <span class="hostname">王小希</span>
                        </div>
                    </div>
                    <div class="bottom-bg"></div>
                </div>
                <div class="live-broadcast-wrapper live-broadcast-wrapper-right">
                    <div class="live-broadcast-item">
                        <div class="live-broadcast-info">
                            <span><i class="live-broadcast-icon"></i><em>直播中</em></span>
                            <span>500人观看</span>
                        </div>
                        <img src="" alt="">
                        <div class="live-broadcast-desc">
                            <div class="title">多空信号这样用就对了</div>
                            <span class="hostname">王小希</span>
                        </div>
                    </div>
                    <div class="live-broadcast-item">
                        <div class="live-broadcast-info">
                            <span><i class="live-broadcast-icon"></i><em>直播中</em></span>
                            <span>500人观看</span>
                        </div>
                        <img src="" alt="">
                        <div class="live-broadcast-desc">
                            <div class="title">多空信号这样用就对了</div>
                            <span class="hostname">王小希</span>
                        </div>
                    </div>
                </div> -->


                <!-- <div class="live-broadcast-item">
                    <div class="live-broadcast-info">
                        <span><i class="live-broadcast-icon"></i><em>直播中</em></span>
                        <span>500人观看</span>
                    </div>
                    <img src="" alt="">
                    <div class="live-broadcast-desc">
                        <div class="title">多空信号这样用就对了</div>
                        <span class="hostname">王小希</span>
                    </div>
                </div>
                <div class="live-broadcast-wrapper">
                    <div class="live-broadcast-item">
                        <div class="live-broadcast-info">
                            <span><i class="live-broadcast-icon"></i><em>直播中</em></span>
                            <span>500人观看</span>
                        </div>
                        <img src="" alt="">
                        <div class="live-broadcast-desc">
                            <div class="title">多空信号这样用就对了</div>
                            <span class="hostname">王小希</span>
                        </div>
                    </div>
                    <div class="live-broadcast-item">
                        <div class="live-broadcast-info">
                            <span><i class="live-broadcast-icon"></i><em>直播中</em></span>
                            <span>500人观看</span>
                        </div>
                        <img src="" alt="">
                        <div class="live-broadcast-desc">
                            <div class="title">多空信号这样用就对了</div>
                            <span class="hostname">王小希</span>
                        </div>
                    </div>
                </div> -->
            </div>
            <!-- <div class="swiper-container-zbzq">
                <div class="swiper-wrapper">
                    <div class="swiper-slide live-broadcast-group">
                        <div class="live-broadcast-item">
                            <div class="live-broadcast-info">
                                <span><i class="live-broadcast-icon"></i><em>回放</em></span>
                                <span>500人观看</span>
                            </div>
                            <img src="" alt="">
                        </div>
                    </div>
                </div>
            </div> -->
        </div>

        <!--短视频-->
        <div class="home_new-list dsp">
            <div class="tztui-list-title jr-title pad15">
                <div class="btm-line">
                    <span class="title">短视频</span>
                    <span class="more">
						<i class="right-arrow"></i>
					</span>
                </div>
            </div>

<!--            <div class="swiper-container-dsp">-->
<!--                <div class="swiper-wrapper">-->
<!--                    <div class="swiper-slide dsp-group">-->
<!--                        <div class="dsp-item">-->
<!--                             <img src="" alt=""> -->
<!--                        </div>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->
            <div class="all-video-group clear">
                <div>
                    <div class="skeleton skeleton-animated" style="height: 1.14rem;width: 48.5%;"> </div>
                    <div class="skeleton skeleton-animated" style="height: 1.14rem;width: 48.5%;margin-left: .05rem;"> </div>
                </div>
                <div>
                    <div class="skeleton skeleton-animated" style="height: 1.14rem;width: 48.5%;"> </div>
                    <div class="skeleton skeleton-animated" style="height: 1.14rem;width: 48.5%;margin-left: .05rem;"> </div>
                </div>
<!--                <div class="all-video-list">-->
<!--                    <div class="list-img">-->
<!--                        <img src="/common/img/banner_mall_LCZX.png" alt="">-->
<!--                        <div class="list-img-desc">-->
<!--                            <span>1</span>-->
<!--                            <span>1</span>-->
<!--                        </div>-->
<!--                    </div>-->
<!--                    <div class="list-title">1</div>-->
<!--                    <div class="list-time">1</div>-->
<!--                </div>-->
            </div>
        </div>

        <!--视频课程-->
        <div class="home_new-list spkc">
            <div class="tztui-list-title jr-title pad15">
                <div class="btm-line">
                    <span class="title">视频课程</span>
                    <span class="more">
						<i class="right-arrow"></i>
					</span>
                </div>
            </div>
            <div class="video-group"></div>
        </div>
    </div>

</body>
<script src="./js/getSvgIcon.js"></script>
<script>
    //直播专区
    var statusName = {
        '0': '预约',
        '1': '直播中',
        '2': '回放'
    }
    getzbzqInfo();
    function getzbzqInfo() {
        $(".swiper-container-zbzq .swiper-wrapper").html("");
        $.getData({
            oSendData: {
                action: 48012,
                method: 'post',
                path: '/redirect',
                targetPath: '/utilServer/innerApi/HJLive/getLiveListTop3',
                pageNumber: 1,
                // pageSize: 1,
                ReqlinkType: 2, //资讯通道
            },
            isload: false,
            fnSuccess: function(data) {
                if(data && data.DATA) {
                    var oData = $.parseJSON(data.DATA).content;
                    console.log(oData)
                    if(oData.length > 0) {
                        var itemHtml = '';
                        var innerItemHtml = '';
                        for(var i=0; i<oData.length; i++) {
                            var cover = oData[i].cover, //直播封面图
                                sharePoster= oData[i].sharePoster, //分享链接图片4:3
                                status = oData[i].status, //直播间状态 0未开始 1直播中 2已结束
                                viewers = oData[i].viewers, //观看人数
                                virtualVists = oData[i].virtualVists, //虚拟观看人数
                                h5Url = oData[i].h5Url,
                                title = oData[i].title,
                                hostname = oData[i].hostname,
                                liveLink = oData[i].liveLink, //直播链接 status为0、1时取该字段
                                videoLink = oData[i].videoLink || ''; //回放视频链接 status为2时取该字段且只有结束才有
                            var viewersNum = virtualVists + viewers;
                            if(status == '0') {
                                var viewersInfo = '<span style="display:none"></span>';
                                var statusClassName = 'status-blue';
                                var viewButton = '';
                            } else if(status == '1') {
                                var viewersInfo = '<span>'+ viewersNum + '观看</span>';
                                var statusClassName = 'status-red';
                                var viewButton = '<div class="to-view-box status-red"><span class="view">去观看</span>'+getZBPlaySvgIcon()+'</div>';
                            } else {
                                var viewersInfo = '<span>'+ viewersNum + '观看</span>';;
                                var statusClassName = 'status-yellow';
                                var viewButton = '';
                            }
                                if(i === 0) {
                                    itemHtml += '<div class="live-broadcast-wrapper live-broadcast-wrapper-left"><div class="live-broadcast-item" data-status="'+status+'" data-liveLink="'+liveLink+'" data-videoLink="'+videoLink+'" data-h5Url="'+ h5Url +'">' +
                                                    '<div class="live-broadcast-info">' +
                                                        '<span class="'+statusClassName+'">'+getZBStatusSvgIcon(status)+'<em class="status">'+statusName[status]+'</em></span>' +
                                                        viewersInfo +
                                                    '</div>' +
                                                    '<img src="'+sharePoster+'" alt="">' +
                                                    '<div class="live-broadcast-desc">' +
                                                        '<div class="title"><p>'+title+'</p></div>' +
                                                        '<span class="hostname">'+hostname+'</span>' +
                                                    '</div>' +
                                                    viewButton +
                                                '</div></div>'
                                } else {
                                    innerItemHtml += '<div class="live-broadcast-item" data-status="'+status+'" data-liveLink="'+liveLink+'" data-videoLink="'+videoLink+'" data-h5Url="'+ h5Url +'">' +
                                                    '<div class="live-broadcast-info">' +
                                                        '<span class="'+statusClassName+'">'+getZBStatusSvgIcon(status)+'<em class="status">'+statusName[status]+'</em></span>' +
                                                        viewersInfo +
                                                    '</div>' +
                                                    '<img src="'+cover+'" alt="">' +
                                                    '<div class="live-broadcast-desc">' +
                                                        '<div class="title">'+title+'</div>' +
                                                        '<span class="hostname">'+hostname+'</span>' +
                                                    '</div>' +
                                                '</div>'
                                }
                            // itemHtml += '<div class="swiper-slide live-broadcast-group" data-status="'+status+'" data-liveLink="'+liveLink+'" data-videoLink="'+videoLink+'" data-h5Url="'+ h5Url +'">'+
                            //                 '<div class="live-broadcast-item">'+
                            //                     '<div class="live-broadcast-info">'+
                            //                         '<span>'+getZBStatusSvgIcon(status)+'<em class="status">'+statusName[status]+'</em></span>'+
                            //                         '<span>'+viewers+'人观看</span>'+
                            //                     '</div>'+
                            //                     '<img src="'+cover+'" alt="">'+
                            //                 '</div>'+
                            //             '</div>'  
                        }
                        $('.live-broadcast-group').html(itemHtml+'<div class="live-broadcast-wrapper live-broadcast-wrapper-right">'+innerItemHtml+'</div>');
                        // $('.swiper-container-zbzq .swiper-wrapper').html(itemHtml);
                        // oVal.swiperZBZQ = new Swiper('.swiper-container-zbzq', {
                        //         //autoplay: 3000,//可选选项，自动滑动
                        //         autoplayDisableOnInteraction : false,//用户操作swiper之后，是否禁止autoplay。默认为true：停止。
                        //         observer:true,//图片加载失败会删除元素，需要更新swiper
                        //         observerParents:true,
                        //         autoplay:3000,
                        //         loop:true,
                        // });
                        zbzqEvent();
                    } else {
                        $(".zbzq").hide();
                    }
                } else {
                    $(".zbzq").hide();
                }
            },
            oConfig:function (error) {
                $(".zbzq").hide();
            }
        })
    }
    function zbzqEvent() {
        $(".zbzq .more").off().on("click",function () {
            if(oVal.configData){
                //直播更多字段ZBZQMORE
                if(oVal.configData.ZBZQMORE){
                    // 首页栏位点击-股票组合
                    pageSensors.reportClick('mainPageColumnClick', {
                        column_type: '直播专区',
                        column_name: '直播专区-更多',
                        column_no: ''
                    })

                    T.fn.action10061({url:oVal.configData.ZBZQMORE});
                }
            }
        });
        $(".live-broadcast-group .live-broadcast-item").off().on("click",function () {
            var status =  $(this).attr('data-status');
            var h5Url =  $(this).attr('data-h5Url');
            var videoLink =  $(this).attr('data-videoLink');
            pageSensors.reportClick('mainPageColumnClick', {
                column_type: '直播专区',
                column_name: '直播专区点击',
                column_no: $(this).index()
            })
            // if(status == 0 || status == 1){
                T.fn.action10061(h5Url);
            // }
            // if(status == 2) {
            //     T.fn.action10061(videoLink);
            // }
        })
    }

    // 短视频
    getDSPInfo();
    function getDSPInfo() {
        $.getData({
            oSendData: {
                'action': '41500',
                'type': 'DSP',
                'ReqlinkType': '2'
            },
            isload: false,
            fnSuccess: function(oData) {
                console.log(oData);
                // ID_INDEX:"0"
                // IMAGE_ALL_URL_INDEX:"3"
                // IMAGE_CLICK_INDEX:"1"
                // IMAGE_TITLE_INDEX:"4"
                // IMAGE_URL_INDEX:"2"
                // IMG_ORD_INDEX:"6"
                // LOGIN_IMG_ORD_INDEX:"7"
                // NEED_LOAD_INDEX:"5"
                // PAUSE_TIME_INDEX:"8"
                // YPE_INDEX:"10"
                // CLICKTYPE_INDEX:"9"
                if(oData.GRID0 && oData.GRID0.length > 1){
                    var data_grid=oData.GRID0;
                    data_grid.shift();
                    // var sHtml='';
                    // for(var i=0;i<data_grid.length;i++){
                    //     var data = data_grid[i].split("|"),
                    //         click_url = data[oData.IMAGE_CLICK_INDEX],
                    //         img_title = data[oData.IMAGE_TITLE_INDEX],
                    //         img_url = data[oData.IMAGE_URL_INDEX];
                    //     if(img_url){
                    //         sHtml+='<div class="swiper-slide dsp-group"><div class="dsp-item"><img class="image" src="'+img_url+'" data-title="'+ img_title +'" data-url="'+click_url+'" onerror="$(this).parent().remove();"></div></div>';
                    //     }
                    // }

                    var itemHtml = '';
                    var dataLn = data_grid.length > 4 ? 4 : data_grid.length;
                    for(var i = 0; i < dataLn; i++) {
                        var data = data_grid[i].split("|");
                        var img_url = data[oData.IMAGE_URL_INDEX],
                            click_url = data[oData.IMAGE_CLICK_INDEX],
                            img_title = data[oData.IMAGE_TITLE_INDEX];
                        itemHtml += '<div class="all-video-list"  data-url="'+ click_url +'">\n' +
                            '             <div class="list-img">\n' +
                            '                <img src="'+ img_url +'" alt="">\n' +
                            '            </div>\n' +
                            '            <div class="list-title">'+ img_title +'</div>\n' +
                            '        </div>'
                    }
                    $(".dsp .all-video-group").html(itemHtml);

                    //$(".swiper-container-dsp .swiper-wrapper").html(sHtml);
                    // oVal.swiperBannerOld = new Swiper('.swiper-container-dsp', {
                    //     autoplay: 3000,//可选选项，自动滑动
                    //     autoplayDisableOnInteraction : false,//用户操作swiper之后，是否禁止autoplay。默认为true：停止。
                    //     observer:true,//图片加载失败会删除元素，需要更新swiper
                    //     observerParents:true,
                    //     loop:true
                    // });

                    DSPEvent();
                }else{
                    $('.dsp').hide();
                }
            },
            oConfig:function (error) {
                $('.dsp').hide();
            }
        })
    }
    function DSPEvent() {
        $(".swiper-container-dsp .swiper-slide img").off().on("click",function () {
            var url =  $(this).attr('data-url');
            if(url){
                T.fn.action10061({url:url,'tzthiddentitle':'0','tztadjustnever':'0'});
            }
        })

        $(".dsp .more").off().on("click",function () {
            if(oVal.configData){
                //课程更多字段DSPMORE
                if(oVal.configData.DSPMORE){
                    T.fn.action10061({url:oVal.configData.DSPMORE,'tzthiddentitle':'0','tztadjustnever':'0'});
                }
            }
        });

        $(".dsp .all-video-list").off().on("click",function () {
            if(oVal.configData){
                //全部视频详情字段TGVIDEADETAILLINK
                if(oVal.configData.TGVIDEADETAILLINK){
                    pageSensors.reportClick('mainPageColumnClick', {
                        column_type: '短视频',
                        column_name: '短视频点击',
                        column_no: $(this).index()
                    });
                    var url =  $(this).attr('data-url');
                    if(url){
                        T.fn.action10061({url:url,'tzthiddentitle':'0','tztadjustnever':'0'});
                    }
                }
            }
        })
    }

    /*视频课程*/
    getSPKC();
    function getSPKC(){
        $.getData({
            oSendData:{
                action:'49245',
                ReqlinkType:2,
                funcNo: '1106391',
                dataType: "json",
                curPage: "1",
                numPerPage: "3",
                method:'post',
                order_type: 1,
                sort: 'desc'
            },
            isload:false,
            fnSuccess:function(data){
                if(data) {
                    if(data.DATA){
                        $('.spkc').show();
                        var testIp = data.ERRORMESSAGE;
                        var oData = $.parseJSON($.parseJSON(data.DATA));
                        oData = oData[0].data;
                        // console.log("视频课程：",oData);
                        var itemHtml = '';
                        for(var i = 0; i < oData.length; i++) {
                            var curriculum_image = oVal.tgJumpId + oData[i].curriculum_image,
                                curriculum_id = oData[i].curriculum_id;
                            itemHtml += '<div class="video-lists" data-id="'+ curriculum_id +'"><img src="'+ curriculum_image +'" alt=""></div>'
                        }

                        $(".video-group").html(itemHtml);
                        SPKCEvent();
                    }else{
                        $('.spkc').hide();
                    }
                }else{
                    $('.spkc').hide();
                }
            },oConfig:function(error){
                $('.spkc').hide();
            }});
    }
    function SPKCEvent(){
        // 视频课程详情
        $('.spkc .video-lists').off().on('click',  function() {
            var id = $(this).attr('data-id');
            if(oVal.configData){
                if(oVal.configData.TGLINK){
                    testIp = oVal.configData.TGLINK;
                }
            }
            var url = testIp + '/m/app/#/classDetail?curriculum_id='+id+'&source_id=hzzz&&fullscreen=1';
            pageSensors.reportClick('mainPageColumnClick', {
                column_type: '视频课程',
                column_name: '视频课程点击',
                column_no: $(this).index()
            })
            tgFunc(url);
        })
        // 视频课程更多
        $('.spkc .more').off().on('click',  function() {
            if(oVal.configData){
                if(oVal.configData.TGVIDEALINK){
                    testIp = oVal.configData.TGVIDEALINK;
                }
            }
            var url = testIp + '/m/app/#/videoIndex?source_id=hzzz&&fullscreen=1';
            pageSensors.reportClick('mainPageColumnClick', {
                column_type: '视频课程',
                column_name: '视频课程-更多',
                column_no: ''
            })
            tgFunc(url);
        })
    }

    /*全部视频*/
    //getQBSP();
    function getQBSP(){
        $.getData({
            oSendData:{
                action:'49245',
                ReqlinkType:"2",
                funcNo: '1106387',
                video_type: "1",
                order_type: "2",
                sort: "desc",
                curPage: "1",
                numPerPage: "6",
                dataType: "json",
                method:'post'
            },
            isload:false,
            fnSuccess:function(data){
                if(data) {
                    if(data.DATA){
                        $('.qbsp').show();
                        testIp = data.ERRORMESSAGE;
                        var oData = $.parseJSON($.parseJSON(data.DATA));
                        oData = oData[0].data;
                        // console.log("全部视频：",oData);
                        var itemHtml = '';
                        for(var i = 0; i < oData.length; i++) {
                            var video_pic_url = oVal.tgJumpId + oData[i].video_pic_url,
                                video_title = oData[i].video_title,
                                publish_time = oData[i].publish_time,
                                video_play_num = oData[i].video_play_num,
                                video_id = oData[i].id,
                                invest_name = oData[i].invest_name;
                            itemHtml += '<div class="all-video-list"  data-id="'+ video_id +'">\n' +
                                '             <div class="list-img">\n' +
                                '                <img src="'+ video_pic_url +'" alt="">\n' +
                                '                <div class="list-img-desc">\n' +
                                '                    <span class="img-video">'+ video_play_num +'</span>\n' +
                                '                    <span>'+ invest_name +'</span>\n' +
                                '                </div>\n' +
                                '            </div>\n' +
                                '            <div class="list-title">'+ video_title +'</div>\n' +
                                '            <div class="list-time">'+ publish_time +'</div>\n' +
                                '        </div>'
                        }

                        $(".all-video-group").html(itemHtml);
                        QBSPEvent();
                    }else{
                        $('.qbsp').hide();
                    }
                }else{
                    $('.qbsp').hide();
                }
            },oConfig:function(error){
                $('.qbsp').hide();
            }});
    }
    function QBSPEvent(){
        $(".qbsp .more").off().on("click",function () {
            if(oVal.configData){
                //全部视频更多字段TGVIDEALINK
                if(oVal.configData.TGVIDEALINK){
                    pageSensors.reportClick('mainPageColumnClick', {
                        column_type: '短视频',
                        column_name: '短视频-更多',
                        column_no: ''
                    })

                    T.fn.action10061({url:oVal.configData.TGVIDEALINK,'tzthiddentitle':'1','tztadjustnever':'1'});
                }
            }
        });
        $(".qbsp .all-video-list").off().on("click",function () {
            if(oVal.configData){
                //全部视频详情字段TGVIDEADETAILLINK
                if(oVal.configData.TGVIDEADETAILLINK){
                     pageSensors.reportClick('mainPageColumnClick', {
                        column_type: '短视频',
                        column_name: '短视频点击',
                        column_no: $(this).index()
                    })
                    var oUrl = oVal.configData.TGVIDEADETAILLINK.replace("{id}",$(this).attr("data-id"));
                    T.fn.action10061({url:oUrl,'tzthiddentitle':'1','tztadjustnever':'1'});
                }
            }
        })
    }

    $(".page-wrapper").off("scroll").scroll(function(){
        //控制首页顶部显示，与客户端交互
        reqrolloffset();

        var scrollTop = $(".page-wrapper").scrollTop();
        var headerHeight = $(".header").height();
        var scrollHeight = $(".more-page").height() + headerHeight;//总高度
        var screenHeight = $("body").height();//屏幕高度
        console.log("推荐页--",scrollHeight,(scrollTop + screenHeight*2));
        var appHeight = $(".app-header").height();
        if (commonFunction.compareVersion(oVal.currVersion, oVal.limitedVersion)) {
            appHeight = 0;
        }
        if(scrollTop >= (headerHeight - appHeight)){
            $(".nav-group").addClass("nav-group-fixed");
            if(appHeight != "0"){
                $(".nav-group").css("top",appHeight + "px")
                $('.title-bar').css({'display':'block','position': 'fixed','height':appHeight + "px",'width':'100%',"top":"0px",'z-index':'2'})
            }
        }else{
            $(".nav-group").removeClass("nav-group-fixed");
            if(appHeight != "0"){
                $(".nav-group").css("top","inherit")
                $('.title-bar').css({'display':'none','position': 'relative','height':"0px"})
            }
        }
        if(scrollTop + screenHeight*2 >= scrollHeight){
            if(oVal.loadYWFlag && oVal.ywNextPage){
                console.log("加载数据");
                console.log("oVal.configData.THS_MZ_KEY",oVal.configData.THS_MZ_KEY);

            }
        }
    });
</script>
</html>